package com.xgit.iov.work.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xgit.iov.common.core.service.impl.SuperServiceImpl;
import com.xgit.iov.work.mapper.DbdSimMapper;
import com.xgit.iov.work.model.DbdSim;
import com.xgit.iov.work.service.IDbdSimService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * SIM卡Service业务层处理
 *
 * @author william
 * @date 2020-10-19
 */

@Service
public class DbdSimServiceImpl extends SuperServiceImpl<DbdSimMapper, DbdSim> implements IDbdSimService {

    @Autowired
    private DbdSimMapper dbdSimMapper;

    /**
     * 查询SIM卡列表
     *
     * @param dbdSim SIM卡
     * @return SIM卡
     */
    @Override
    public IPage selectDbdSimPage(Page page, DbdSim dbdSim) {
        dataRuleFilter(dbdSim);
        return dbdSimMapper.selectDbdSimPage(page,dbdSim);
    }

    /**
     * 新增SIM卡
     *
     * @param dbdSim SIM卡
     * @return 结果
     */
    @Transactional
    @Override
    public int insertDbdSim(DbdSim dbdSim) {
        return dbdSimMapper.insert(dbdSim);
    }

    /**
     * 修改SIM卡
     *
     * @param dbdSim SIM卡
     * @return 结果
     */
    @Transactional
    @Override
    public int updateDbdSim(DbdSim dbdSim) {
        return dbdSimMapper.updateById(dbdSim);
    }

    /**
     * 批量删除SIM卡
     *
     * @param ids 需要删除的SIM卡ID
     * @return 结果
     */
    @Transactional
    @Override
    public int deleteDbdSimByIds(Long[] ids) {
        return dbdSimMapper.deleteBatchIds(CollUtil.toList(ids));
    }

}
